home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright 1993, 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
-
- /*******************************************************************************
- CreateGroup.c
-
- *******************************************************************************/
-
- #include <stdio.h>
- #include <Xm/Xm.h>
- #include <X11/Xirisw/GlxMDraw.h>
- #include <X11/Shell.h>
- #include <Xm/MenuShell.h>
- #include "UxXt.h"
-
- #include <Xm/List.h>
- #include <Xm/ScrolledW.h>
- #include <Xm/SeparatoG.h>
- #include <Xm/Label.h>
- #include <Xm/RowColumn.h>
- #include <Xm/PushB.h>
- #include <Xm/Frame.h>
- #include <Xm/TextF.h>
- #include <Xm/Form.h>
-
- /*******************************************************************************
- Includes, Defines, and Global variables from the Declarations Editor:
- *******************************************************************************/
-
- #include "exinterfmotif.h"
- #include <string.h>
- #include "exbookglo.h"
- #include "exglobals.h"
- #include "exinterf.h"
-
- extern void popup_colorview();
- extern void popdown_colorview();
- void dogroupview();
-
- static GLXconfig glxconfig[] = {
- {GLX_NORMAL, GLX_ZSIZE, GLX_NOCONFIG},
- {GLX_NORMAL, GLX_RGB, TRUE},
- {0, 0, 0} };
-
- static char defaultTranslations[] =
- "<EnterNotify>: glxInput() \n\
- <LeaveNotify>: glxInput()";
-
- static Boolean in_group_window = FALSE;
-
- /*******************************************************************************
- The definition of the context structure:
- If you create multiple instances of your interface, the context
- structure ensures that your callbacks use the variables for the
- correct instance.
-
- For each Widget in the interface, each argument to the Interface
- function, and each variable in the Instance Specific section of the
- Declarations Editor, there is an entry in the context structure.
- and a #define. The #define makes the variable name refer to the
- corresponding entry in the context structure.
- *******************************************************************************/
-
- typedef struct
- {
- Widget UxGroupNameText;
- Widget UxGroupHelpFileText;
- Widget UxGroupDoneButton;
- Widget UxGroupCancelButton;
- Widget UxGroupNextButton;
- Widget UxGroupExistKeywordWindow;
- Widget UxGroupExistKeywordList;
- Widget UxGroupNewKeywordText;
- Widget UxGroupKeywordWindow;
- Widget UxGroupKeywordList;
- Widget UxGroupDeleteButton;
- Widget UxColorButton;
- Widget UxGroupGL;
- } _UxCCreateGroup;
-
- #define GroupNameText UxCreateGroupContext->UxGroupNameText
- #define GroupHelpFileText UxCreateGroupContext->UxGroupHelpFileText
- #define GroupDoneButton UxCreateGroupContext->UxGroupDoneButton
- #define GroupCancelButton UxCreateGroupContext->UxGroupCancelButton
- #define GroupNextButton UxCreateGroupContext->UxGroupNextButton
- #define GroupExistKeywordWindow UxCreateGroupContext->UxGroupExistKeywordWindow
- #define GroupExistKeywordList UxCreateGroupContext->UxGroupExistKeywordList
- #define GroupNewKeywordText UxCreateGroupContext->UxGroupNewKeywordText
- #define GroupKeywordWindow UxCreateGroupContext->UxGroupKeywordWindow
- #define GroupKeywordList UxCreateGroupContext->UxGroupKeywordList
- #define GroupDeleteButton UxCreateGroupContext->UxGroupDeleteButton
- #define ColorButton UxCreateGroupContext->UxColorButton
- #define GroupGL UxCreateGroupContext->UxGroupGL
-
- void initCB_Group( Widget w, XtPointer client_data, XtPointer call_data);
- void exposeCB_Group( Widget w, XtPointer client_data, XtPointer call_data);
- void resizeCB_Group( Widget w, XtPointer client_data, XtPointer call_data);
- void inputCB_Group( Widget w, XtPointer client_data, XtPointer call_data);
-
- static _UxCCreateGroup *UxCreateGroupContext;
-
- /*
- Widget CreateGroup;
- */
-
- /*******************************************************************************
- Forward declarations of functions that are defined later in this file.
- *******************************************************************************/
-
- Widget create_CreateGroup();
-
- void setgroupwin()
- {
- GLXwinset (XtDisplay(GroupGL), XtWindow(GroupGL) );
- dogroupview();
- }
-
- void dogroupview()
- {
- GLXwinset (XtDisplay(GroupGL), XtWindow(GroupGL) );
- setgroupview();
- }
-
- /*******************************************************************************
- The following are callback functions.
- *******************************************************************************/
-
- void exposeCB_Group( Widget w, XtPointer client_data, XtPointer call_data)
- {
- GLXwinset (XtDisplay(w), XtWindow(w) );
- dogroupview();
- drawgroupwin();
- }
-
- void resizeCB_Group( Widget w, XtPointer client_data, XtPointer call_data)
- {
- GLXwinset (XtDisplay(w), XtWindow(w) );
- reshapeviewport();
- dogroupview();
- }
- void initCB_Group( Widget w, XtPointer client_data, XtPointer call_data)
- {
- GLXwinset (XtDisplay(w), XtWindow(w) );
- dogroupview();
-
- c3s(morecolors[9]);
- clear();
- }
-
- void inputCB_Group(Widget w, XtPointer client_data, XtPointer call_data)
- {
- GlxDrawCallbackStruct *glcall;
-
- glcall = (GlxDrawCallbackStruct *)call_data;
- switch (glcall->event->type)
- {
- case EnterNotify:
- in_group_window = TRUE;
- /*
- if (seliconptr != NULL)
- {
- printf(" seliconptr != NULL %s\n", seliconptr->iconptr->nameptr->string);
- }
- */
- break;
- case LeaveNotify:
- in_group_window = FALSE;
- break;
- case ButtonPress:
- break;
- case ButtonRelease:
- break;
- case MotionNotify:
- break;
- }
- }
-
- static void activateCB_GroupDoneButton( UxWidget, UxClientData, UxCallbackArg )
- Widget UxWidget;
- XtPointer UxClientData, UxCallbackArg;
- {
- _UxCCreateGroup *UxSaveCtx, *UxContext;
- struct charlist *charptr, *prevcharptr;
- char *tmpstr;
-
- UxSaveCtx = UxCreateGroupContext;
- UxCreateGroupContext = UxContext =
- (_UxCCreateGroup *) UxGetContext( UxWidget );
- {
- strcpy (AGName.buf, (char *)XmTextFieldGetString(GroupNameText));
- AGName.bufpos = strlen(AGName.buf);
- if (AGName.bufpos <= 0) {
- sprintf(msgstring, "\nYou must enter a Name.\n");
- DialogType = 1;
- popup_Message();
- }
- else {
- if (newgrpptr != NULL) {
- tmpstr = XmTextFieldGetString(GroupHelpFileText);
- printf(" tmpstr = %s \n",tmpstr);
- strcpy(AGHfile.buf, tmpstr);
- XtFree(tmpstr);
- AGHfile.bufpos = strlen(AGHfile.buf);
- GetGroupKeywords();
- if (newgroupiconlist != NULL)
- {
- if (EditGroupFlag == 0) {
- add_group(newgrpptr, lastgroup);
- }
- else {
- savegroupchanges(newgrpptr);
- EditGroupFlag = 0;
- }
- }
- else /* there were no icons, treat the done button
- like a cancel button */
- {
- if (EditGroupFlag == 0)
- {
- free(newgrpptr);
- free(curnewpage);
- }
- else if (EditGroupFlag == 1)
- {
- EditGroupFlag = 0;
- charptr = HeadGrpChar;
- while (charptr != NULL)
- {
- prevcharptr = charptr->next;
- if (charptr->indexflag == 0)
- free(charptr->str);
- free(charptr);
- charptr = prevcharptr;
- }
- HeadGrpChar = NULL;
- TailGrpChar = NULL;
- }
- }
- newgrpptr = NULL;
- curnewpage = NULL;
- XtVaSetValues( GroupNameText, XmNvalue, "", NULL );
- XtVaSetValues( GroupHelpFileText, XmNvalue, "", NULL );
- XtVaSetValues( GroupNewKeywordText, XmNvalue, "", NULL );
- XmListDeselectAllItems(GroupExistKeywordList);
- XmListSetPos(GroupExistKeywordList, 1);
- XmListDeleteAllItems(GroupKeywordList);
- MotifGroupWin = -1;
- UxPopdownInterface(CreateGroup);
- /* MB 5/4/93 temporarily taking the color picker out of demobook
- popdown_colorview();
- */
- InterfaceWinOpen-- ;
- dobookview();
- }
- }
- }
- UxCreateGroupContext = UxSaveCtx;
- }
-
- static void activateCB_GroupCancelButton( UxWidget, UxClientData, UxCallbackArg )
- Widget UxWidget;
- XtPointer UxClientData, UxCallbackArg;
- {
- _UxCCreateGroup *UxSaveCtx, *UxContext;
-
- UxSaveCtx = UxCreateGroupContext;
- UxCreateGroupContext = UxContext =
- (_UxCCreateGroup *) UxGetContext( UxWidget );
- {
- struct charlist *charptr, *prevcharptr;
-
- if (EditGroupFlag == 0) {
- free(newgrpptr);
- free(curnewpage);
- newgrpptr = NULL;
- curnewpage = NULL;
- }
- if (EditGroupFlag == 1) {
- EditGroupFlag = 0;
- charptr = HeadGrpChar;
- while (charptr != NULL) {
- prevcharptr = charptr->next;
- if (charptr->indexflag == 0) free(charptr->str);
- free(charptr);
- charptr = prevcharptr;
- }
- HeadGrpChar = NULL;
- TailGrpChar = NULL;
- }
- clear_iconlist(newgroupiconlist);
- newgroupiconlist = NULL;
- newgrouplasticon = NULL;
- freegpform();
- XtVaSetValues( GroupNameText, XmNvalue, "", NULL );
- XtVaSetValues( GroupHelpFileText, XmNvalue, "", NULL );
- XtVaSetValues( GroupNewKeywordText, XmNvalue, "", NULL );
- XmListDeselectAllItems(GroupExistKeywordList);
- XmListSetPos(GroupExistKeywordList, 1);
- XmListDeleteAllItems(GroupKeywordList);
- MotifGroupWin = -1;
- UxPopdownInterface(CreateGroup);
- /* MB 5/4/93 temporarily taking the color picker out of demobook
- popdown_colorview();
- */
- InterfaceWinOpen-- ;
- drawscene(0);
- }
- UxCreateGroupContext = UxSaveCtx;
- }
-
- static void activateCB_GroupNextButton( UxWidget, UxClientData, UxCallbackArg )
- Widget UxWidget;
- XtPointer UxClientData, UxCallbackArg;
- {
- _UxCCreateGroup *UxSaveCtx, *UxContext;
- struct charlist *charptr, *prevcharptr;
- char *tmpstr;
-
- UxSaveCtx = UxCreateGroupContext;
- UxCreateGroupContext = UxContext =
- (_UxCCreateGroup *) UxGetContext( UxWidget );
- {
- strcpy (AGName.buf, (char *)XmTextFieldGetString(GroupNameText));
- AGName.bufpos = strlen(AGName.buf);
- if (AGName.bufpos <= 0) {
- sprintf(msgstring, "\nYou must enter a Name.\n");
- DialogType = 1;
- popup_Message();
- }
- else {
- if (newgrpptr != NULL) {
- if (newgroupiconlist != NULL)
- {
- tmpstr = XmTextFieldGetString(GroupHelpFileText);
- strcpy(AGHfile.buf, tmpstr);
- XtFree(tmpstr);
- AGHfile.bufpos = strlen(AGHfile.buf);
- GetGroupKeywords();
- add_group(newgrpptr, lastgroup);
- }
- else
- {
- EditGroupFlag = 0;
- charptr = HeadGrpChar;
- while (charptr != NULL)
- {
- prevcharptr = charptr->next;
- if (charptr->indexflag == 0)
- free(charptr->str);
- free(charptr);
- charptr = prevcharptr;
- }
- HeadGrpChar = NULL;
- }
- dogroupview();
- initgroup();
- /* why is this here ? */
- drawgroupwin();
- initgpform();
- XtVaSetValues( GroupNameText, XmNvalue, "", NULL );
- XtVaSetValues( GroupHelpFileText, XmNvalue, "", NULL );
- XtVaSetValues( GroupNewKeywordText, XmNvalue, "", NULL );
- XmListDeselectAllItems(GroupExistKeywordList);
- XmListSetPos(GroupExistKeywordList, 1);
- XtVaSetValues( GroupExistKeywordList,
- XmNitemCount, ExistKeywordCount,
- RES_CONVERT( XmNitems, ExistKeywordString ),
- NULL );
- XmListDeleteAllItems(GroupKeywordList);
- }
- }
- }
- UxCreateGroupContext = UxSaveCtx;
- drawgroupwin();
- }
-
- static void browseSelectionCB_GroupExistKeywordList( UxWidget, UxClientData, UxCallbackArg )
- Widget UxWidget;
- XtPointer UxClientData, UxCallbackArg;
- {
- _UxCCreateGroup *UxSaveCtx, *UxContext;
-
- UxSaveCtx = UxCreateGroupContext;
- UxCreateGroupContext = UxContext =
- (_UxCCreateGroup *) UxGetContext( UxWidget );
- {
- int *pos_list;
- int pos_count;
- int i;
- XmListCallbackStruct *cbs;
-
- cbs = (XmListCallbackStruct *)UxCallbackArg;
- if ( ! (XmListItemExists(GroupKeywordList, cbs->item)) ) {
- XmListAddItem(GroupKeywordList, cbs->item, 0);
- XmListSetBottomPos(GroupKeywordList, 0);
- KW_change = TRUE;
- }
- }
- UxCreateGroupContext = UxSaveCtx;
- }
-
- static void activateCB_GroupNewKeywordText( UxWidget, UxClientData, UxCallbackArg )
- Widget UxWidget;
- XtPointer UxClientData, UxCallbackArg;
- {
- _UxCCreateGroup *UxSaveCtx, *UxContext;
-
- UxSaveCtx = UxCreateGroupContext;
- UxCreateGroupContext = UxContext =
- (_UxCCreateGroup *) UxGetContext( UxWidget );
- {
- XmString item;
- AGKey.bufpos = 0;
- bufclear(&AGKey);
- strcpy(AGKey.buf, (char *)XmTextFieldGetString(GroupNewKeywordText));
- AGKey.bufpos = strlen(AGKey.buf);
- if (AGKey.bufpos > 0) {
- item = (XmString)XmStringCreateLtoR(
- AGKey.buf, XmSTRING_DEFAULT_CHARSET);
- if ( ! (XmListItemExists(GroupKeywordList,item)) ) {
- XmListAddItem(GroupKeywordList, item, 0);
- XmListSetBottomPos(GroupKeywordList, 0);
- XtVaSetValues( GroupNewKeywordText, XmNvalue, "", NULL );
- KW_change = TRUE;
- }
- }
- }
- UxCreateGroupContext = UxSaveCtx;
- }
-
- static void activateCB_GroupDeleteButton( UxWidget, UxClientData, UxCallbackArg )
- Widget UxWidget;
- XtPointer UxClientData, UxCallbackArg;
- {
- _UxCCreateGroup *UxSaveCtx, *UxContext;
-
- UxSaveCtx = UxCreateGroupContext;
- UxCreateGroupContext = UxContext =
- (_UxCCreateGroup *) UxGetContext( UxWidget );
- {
- int *pos_list;
- int pos_count;
- while ( XmListGetSelectedPos(
- (GroupKeywordList), &pos_list, &pos_count) ) {
- XmListDeletePos(GroupKeywordList, pos_list[0]);
- KW_change = TRUE;
- XtFree((char *)pos_list);
- }
- }
- UxCreateGroupContext = UxSaveCtx;
- }
-
- static void activateCB_ColorButton( UxWidget, UxClientData, UxCallbackArg )
- Widget UxWidget;
- XtPointer UxClientData, UxCallbackArg;
- {
- _UxCCreateGroup *UxSaveCtx, *UxContext;
-
- /* MB 5/4/93 this routine should never be called */
- UxSaveCtx = UxCreateGroupContext;
- UxCreateGroupContext = UxContext =
- (_UxCCreateGroup *) UxGetContext( UxWidget );
- {
- /* MB 5/4/93 temporarily taking the color picker out of demobook
- popup_colorview();
- */
- }
- UxCreateGroupContext = UxSaveCtx;
- }
-
- /*******************************************************************************
- The 'build_' function creates all the Widgets and X widgets,
- and sets their properties to the values specified in the
- Property Editor.
- *******************************************************************************/
-
- Widget CreateGroup_shell;
-
- static Widget _Uxbuild_CreateGroup()
- {
- Widget GroupGLframe, CGform;
- Widget form, form2, form3;
- Widget label, sep;
- Arg wargs[10];
- int n;
- XtTranslations mytrans;
-
- CreateGroup_shell = XtVaCreatePopupShell( "CreateBook_shell",
- topLevelShellWidgetClass, DBtoplevel,
- XmNx, 425,
- XmNy, 600,
- XmNwidth, 1000,
- XmNheight, 400,
- XmNtitle, "Book",
- XmNiconName, "CreateBook",
- NULL );
-
- CGform = XtVaCreateManagedWidget( "AddBook",
- xmFormWidgetClass, CreateGroup_shell,
- XmNresizePolicy, XmRESIZE_NONE,
- XmNheight, 400,
- XmNwidth, 1000,
- XmNverticalSpacing, 10,
- XmNhorizontalSpacing, 10,
- NULL );
-
- UxPutContext( CGform, (char *) UxCreateGroupContext );
-
- n = 0;
- XtSetArg(wargs[n], XmNheight, 400); n++;
- XtSetArg(wargs[n], XmNwidth, 340); n++;
- GroupGLframe = XtCreateManagedWidget( "CreateGroup_GLframe",
- xmFrameWidgetClass, CGform,
- wargs, n);
-
- mytrans = XtParseTranslationTable(defaultTranslations);
- n = 0;
- XtSetArg(wargs[n],GlxNglxConfig, glxconfig); n++;
- XtSetArg(wargs[n], XmNheight, 400); n++;
- XtSetArg(wargs[n], XmNwidth, 340); n++;
- XtSetArg (wargs[n], XmNleftAttachment, XmATTACH_FORM); n++;
- XtSetArg (wargs[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(wargs[n], XmNtopAttachment, XmATTACH_FORM); n++;
- XtSetArg(wargs[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- GroupGL = GlxCreateMDraw(GroupGLframe, "glwidget", wargs, n);
- XtAddCallback( GroupGL, GlxNginitCallback, initCB_Group, NULL);
- XtAddCallback( GroupGL, GlxNexposeCallback, exposeCB_Group, NULL);
- XtAddCallback( GroupGL, GlxNresizeCallback, resizeCB_Group, NULL);
- XtAddCallback( GroupGL, GlxNinputCallback, inputCB_Group, NULL);
- XtManageChild(GroupGL);
- XtAugmentTranslations(GroupGL, mytrans);
-
- UxPutContext( GroupGL, (char *) UxCreateGroupContext );
-
- n = 0;
- XtSetArg(wargs[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(wargs[n], XmNtopAttachment, XmATTACH_FORM); n++;
- XtSetArg(wargs[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(wargs[n], XmNleftWidget, GroupGLframe); n++;
- /*
- XtSetArg(wargs[n], XmNverticalSpacing, 10); n++;
- */
- XtSetArg(wargs[n], XmNhorizontalSpacing, 10); n++;
- form = XtCreateManagedWidget( "form",
- xmFormWidgetClass, CGform,
- wargs, n );
-
- /* MB 5/4/93 temporarily taking the color picker out of demobook
- ColorButton = XtVaCreateManagedWidget( "ColorButton",
- xmPushButtonWidgetClass, form,
- XmNrecomputeSize, FALSE,
- XmNmarginWidth, 2,
- XmNmarginTop, 0,
- XmNmarginRight, 0,
- XmNmarginLeft, 0,
- XmNmarginHeight, 2,
- XmNmarginBottom, 0,
- XmNheight, 36,
- XmNwidth, 120,
- XmNalignment, XmALIGNMENT_CENTER,
- XmNhighlightOnEnter, TRUE,
- XmNrightAttachment, XmATTACH_FORM,
- XmNbottomAttachment, XmATTACH_FORM,
- NULL );
-
- UxPutContext( ColorButton, (char *) UxCreateGroupContext );
- */
-
- label = XtVaCreateManagedWidget( "NameLabel",
- xmLabelWidgetClass, form,
- XmNrecomputeSize, FALSE,
- XmNmarginWidth, 2,
- XmNmarginTop, 0,
- XmNmarginRight, 0,
- XmNmarginLeft, 0,
- XmNmarginHeight, 2,
- XmNmarginBottom, 0,
- XmNalignment, XmALIGNMENT_BEGINNING,
- XmNborderWidth, 0,
- XmNleftAttachment, XmATTACH_FORM,
- XmNbottomAttachment, XmATTACH_FORM,
- NULL );
-
- GroupNameText = XtVaCreateManagedWidget( "GroupNameText",
- xmTextFieldWidgetClass, form,
- XmNresizeWidth, FALSE,
- XmNhighlightOnEnter, TRUE,
- XmNtopAttachment, XmATTACH_FORM,
- XmNleftAttachment, XmATTACH_WIDGET,
- XmNleftWidget, label,
- /* MB 5/4/93 temporarily taking the color picker out of demobook
- XmNrightAttachment, XmATTACH_WIDGET,
- XmNrightWidget, ColorButton,
- */
- XmNrightAttachment, XmATTACH_FORM,
- XmNbottomAttachment, XmATTACH_FORM,
- NULL );
-
- UxPutContext( GroupNameText, (char *) UxCreateGroupContext );
-
- n = 0;
- XtSetArg(wargs[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(wargs[n], XmNleftWidget, GroupGLframe); n++;
- XtSetArg(wargs[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(wargs[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetArg(wargs[n], XmNverticalSpacing, 10); n++;
- XtSetArg(wargs[n], XmNhorizontalSpacing, 10); n++;
- form3 = XtCreateManagedWidget( "form3",
- xmFormWidgetClass, CGform, wargs, n );
-
- GroupCancelButton = XtVaCreateManagedWidget( "CancelButton",
- xmPushButtonWidgetClass, form3,
- XmNrecomputeSize, FALSE,
- XmNmarginWidth, 2,
- XmNmarginTop, 0,
- XmNmarginRight, 0,
- XmNmarginLeft, 0,
- XmNmarginHeight, 2,
- XmNmarginBottom, 0,
- XmNalignment, XmALIGNMENT_CENTER,
- XmNhighlightOnEnter, TRUE,
- XmNrightAttachment, XmATTACH_FORM,
- NULL );
-
- UxPutContext( GroupCancelButton, (char *) UxCreateGroupContext );
-
- GroupDoneButton = XtVaCreateManagedWidget( "DoneButton",
- xmPushButtonWidgetClass, form3,
- XmNrecomputeSize, FALSE,
- XmNmarginWidth, 2,
- XmNmarginTop, 0,
- XmNmarginRight, 0,
- XmNmarginLeft, 0,
- XmNmarginHeight, 2,
- XmNmarginBottom, 0,
- XmNalignment, XmALIGNMENT_CENTER,
- XmNhighlightOnEnter, TRUE,
- XmNrightAttachment, XmATTACH_WIDGET,
- XmNrightWidget, GroupCancelButton,
- NULL );
-
- UxPutContext( GroupDoneButton, (char *) UxCreateGroupContext );
-
- GroupNextButton = XtVaCreateManagedWidget( "NextButton",
- xmPushButtonWidgetClass, form3,
- XmNrecomputeSize, FALSE,
- XmNmarginWidth, 2,
- XmNmarginTop, 0,
- XmNmarginRight, 0,
- XmNmarginLeft, 0,
- XmNmarginHeight, 2,
- XmNmarginBottom, 0,
- XmNalignment, XmALIGNMENT_CENTER,
- XmNhighlightOnEnter, TRUE,
- XmNrightAttachment, XmATTACH_WIDGET,
- XmNrightWidget, GroupDoneButton,
- NULL );
-
- UxPutContext( GroupNextButton, (char *) UxCreateGroupContext );
-
- sep = XtVaCreateManagedWidget( "GroupSeparatorGadget",
- xmSeparatorGadgetClass, CGform,
- XmNshadowThickness, 6,
- XmNleftAttachment, XmATTACH_WIDGET,
- XmNleftWidget, GroupGLframe,
- XmNrightAttachment, XmATTACH_FORM,
- XmNbottomAttachment, XmATTACH_WIDGET,
- XmNbottomWidget, form3,
- NULL );
-
- n = 0;
- XtSetArg(wargs[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(wargs[n], XmNleftWidget, GroupGLframe); n++;
- XtSetArg(wargs[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(wargs[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(wargs[n], XmNtopWidget, form); n++;
- /*
- XtSetArg(wargs[n], XmNverticalSpacing, 10); n++;
- */
- XtSetArg(wargs[n], XmNhorizontalSpacing, 10); n++;
- form3 = XtCreateManagedWidget( "form3",
- xmFormWidgetClass, CGform, wargs, n );
-
- label = XtVaCreateManagedWidget( "HelpFileLabel",
- xmLabelWidgetClass, form3,
- XmNrecomputeSize, FALSE,
- XmNmarginWidth, 2,
- XmNmarginTop, 0,
- XmNmarginRight, 0,
- XmNmarginLeft, 0,
- XmNmarginHeight, 2,
- XmNmarginBottom, 0,
- XmNalignment, XmALIGNMENT_BEGINNING,
- XmNborderWidth, 0,
- XmNleftAttachment, XmATTACH_FORM,
- XmNbottomAttachment, XmATTACH_FORM,
- NULL );
-
- GroupHelpFileText = XtVaCreateManagedWidget( "GroupHelpFileText",
- xmTextFieldWidgetClass, form3,
- XmNresizeWidth, FALSE,
- XmNhighlightOnEnter, TRUE,
- XmNtopAttachment, XmATTACH_FORM,
- XmNleftAttachment, XmATTACH_WIDGET,
- XmNleftWidget, label,
- XmNrightAttachment, XmATTACH_FORM,
- XmNbottomAttachment, XmATTACH_FORM,
- NULL );
-
- UxPutContext( GroupHelpFileText, (char *) UxCreateGroupContext );
-
- n = 0;
- XtSetArg(wargs[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(wargs[n], XmNtopWidget, form3); n++;
- XtSetArg(wargs[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(wargs[n], XmNbottomWidget, sep); n++;
- XtSetArg(wargs[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(wargs[n], XmNleftWidget, GroupGLframe); n++;
- XtSetArg(wargs[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(wargs[n], XmNverticalSpacing, 10); n++;
- XtSetArg(wargs[n], XmNhorizontalSpacing, 10); n++;
- form2 = XtCreateManagedWidget( "CreateGroupform2",
- xmFormWidgetClass, CGform,
- wargs, n );
-
- n = 0;
- XtSetArg(wargs[n], XmNtopAttachment, XmATTACH_FORM); n++;
- XtSetArg(wargs[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetArg(wargs[n], XmNleftAttachment, XmATTACH_FORM); n++;
- form = XtCreateManagedWidget( "CreateGroupform",
- xmFormWidgetClass, form2,
- wargs, n );
-
- label = XtVaCreateManagedWidget( "GroupExistKeywordLabel",
- xmLabelWidgetClass, form,
- XmNrecomputeSize, FALSE,
- XmNmarginWidth, 2,
- XmNmarginTop, 0,
- XmNmarginRight, 0,
- XmNmarginLeft, 0,
- XmNmarginHeight, 2,
- XmNmarginBottom, 0,
- XmNtopAttachment, XmATTACH_FORM,
- XmNalignment, XmALIGNMENT_BEGINNING,
- XmNborderWidth, 0,
- NULL );
-
- GroupExistKeywordWindow = XtVaCreateManagedWidget( "GroupExistKeywordWindow",
- xmScrolledWindowWidgetClass, form,
- RES_CONVERT( XmNbackground, "#7777BB" ),
- XmNvisualPolicy, XmVARIABLE,
- XmNscrollingPolicy, XmAPPLICATION_DEFINED,
- XmNscrollBarDisplayPolicy, XmSTATIC,
- XmNshadowThickness, 0,
- XmNleftAttachment, XmATTACH_FORM,
- XmNbottomAttachment, XmATTACH_FORM,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, label,
- NULL );
-
- UxPutContext( GroupExistKeywordWindow, (char *) UxCreateGroupContext );
-
- GroupExistKeywordList = XtVaCreateManagedWidget( "GroupExistKeywordList",
- xmListWidgetClass, GroupExistKeywordWindow,
- XmNhighlightThickness, 2,
- XmNhighlightOnEnter, TRUE,
- XmNscrollBarDisplayPolicy, XmAS_NEEDED,
- XmNlistSizePolicy, XmCONSTANT,
- XmNvisibleItemCount, 10,
- XmNselectionPolicy, XmBROWSE_SELECT,
- XmNlistMarginWidth, 0,
- XmNlistMarginHeight, 2,
- XmNitemCount, ExistKeywordCount,
- RES_CONVERT( XmNitems, ExistKeywordString),
- XmNwidth, 230,
- NULL );
-
- UxPutContext( GroupExistKeywordList, (char *) UxCreateGroupContext );
-
- n = 0;
- XtSetArg(wargs[n], XmNtopAttachment, XmATTACH_FORM); n++;
- XtSetArg(wargs[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- XtSetArg(wargs[n], XmNrightAttachment, XmATTACH_FORM); n++;
- XtSetArg(wargs[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
- XtSetArg(wargs[n], XmNleftWidget, form); n++;
- form3 = XtCreateManagedWidget( "CreateGroupform",
- xmFormWidgetClass, form2,
- wargs, n );
-
- label = XtVaCreateManagedWidget( "GroupNewKeywordLabel",
- xmLabelWidgetClass, form3,
- XmNrecomputeSize, FALSE,
- XmNmarginWidth, 2,
- XmNmarginTop, 0,
- XmNmarginRight, 0,
- XmNmarginLeft, 0,
- XmNmarginHeight, 2,
- XmNmarginBottom, 0,
- XmNalignment, XmALIGNMENT_BEGINNING,
- XmNborderWidth, 0,
- XmNleftAttachment, XmATTACH_FORM,
- XmNtopAttachment, XmATTACH_FORM,
- NULL );
-
- GroupNewKeywordText = XtVaCreateManagedWidget( "GroupNewKeywordText",
- xmTextFieldWidgetClass, form3,
- XmNresizeWidth, FALSE,
- XmNcolumns, 36,
- XmNmarginWidth, 5,
- XmNmarginHeight, 5,
- XmNhighlightOnEnter, TRUE,
- XmNleftAttachment, XmATTACH_FORM,
- XmNrightAttachment, XmATTACH_FORM,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, label,
- NULL );
-
- UxPutContext( GroupNewKeywordText, (char *) UxCreateGroupContext );
-
- label = XtVaCreateManagedWidget( "GroupKeywordLabel",
- xmLabelWidgetClass, form3,
- XmNrecomputeSize, FALSE,
- XmNmarginWidth, 2,
- XmNmarginTop, 0,
- XmNmarginRight, 0,
- XmNmarginLeft, 0,
- XmNmarginHeight, 2,
- XmNmarginBottom, 0,
- XmNalignment, XmALIGNMENT_BEGINNING,
- XmNborderWidth, 0,
- XmNleftAttachment, XmATTACH_FORM,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, GroupNewKeywordText,
- NULL );
-
- GroupDeleteButton = XtVaCreateManagedWidget( "GroupDeleteButton",
- xmPushButtonWidgetClass, form3,
- XmNrecomputeSize, FALSE,
- XmNmarginWidth, 2,
- XmNmarginTop, 0,
- XmNmarginRight, 0,
- XmNmarginLeft, 0,
- XmNmarginHeight, 2,
- XmNmarginBottom, 0,
- XmNalignment, XmALIGNMENT_CENTER,
- XmNhighlightOnEnter, TRUE,
- XmNrightAttachment, XmATTACH_FORM,
- XmNbottomAttachment, XmATTACH_FORM,
- NULL );
-
- UxPutContext( GroupDeleteButton, (char *) UxCreateGroupContext );
-
- GroupKeywordWindow = XtVaCreateManagedWidget( "GroupKeywordWindow",
- xmScrolledWindowWidgetClass, form3,
- RES_CONVERT( XmNbackground, "#7777BB" ),
- XmNvisualPolicy, XmVARIABLE,
- XmNscrollingPolicy, XmAPPLICATION_DEFINED,
- XmNscrollBarDisplayPolicy, XmSTATIC,
- XmNshadowThickness, 0,
- XmNleftAttachment, XmATTACH_FORM,
- XmNrightAttachment, XmATTACH_FORM,
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, label,
- XmNbottomAttachment, XmATTACH_WIDGET,
- XmNbottomWidget, GroupDeleteButton,
- NULL );
-
- UxPutContext( GroupKeywordWindow, (char *) UxCreateGroupContext );
-
- GroupKeywordList = XtVaCreateManagedWidget( "GroupKeywordList",
- xmListWidgetClass, GroupKeywordWindow,
- XmNhighlightOnEnter, TRUE,
- XmNhighlightThickness, 2,
- RES_CONVERT( XmNhighlightColor, "black" ),
- XmNscrollBarDisplayPolicy, XmAS_NEEDED,
- XmNlistSizePolicy, XmCONSTANT,
- XmNvisibleItemCount, 7,
- XmNselectionPolicy, XmEXTENDED_SELECT,
- XmNlistMarginWidth, 0,
- XmNlistMarginHeight, 2,
- NULL );
-
- UxPutContext( GroupKeywordList, (char *) UxCreateGroupContext );
-
- XtAddCallback( CGform, XmNdestroyCallback,
- UxFreeClientDataCB,
- (XtPointer) UxCreateGroupContext );
-
- XtAddCallback( GroupDoneButton, XmNactivateCallback,
- activateCB_GroupDoneButton,
- (XtPointer) UxCreateGroupContext );
-
- XtAddCallback( GroupCancelButton, XmNactivateCallback,
- activateCB_GroupCancelButton,
- (XtPointer) UxCreateGroupContext );
-
- XtAddCallback( GroupNextButton, XmNactivateCallback,
- activateCB_GroupNextButton,
- (XtPointer) UxCreateGroupContext );
-
- XtAddCallback( GroupExistKeywordList, XmNbrowseSelectionCallback,
- browseSelectionCB_GroupExistKeywordList,
- (XtPointer) UxCreateGroupContext );
-
- XtAddCallback( GroupNewKeywordText, XmNactivateCallback,
- activateCB_GroupNewKeywordText,
- (XtPointer) UxCreateGroupContext );
-
- XtAddCallback( GroupDeleteButton, XmNactivateCallback,
- activateCB_GroupDeleteButton,
- (XtPointer) UxCreateGroupContext );
-
- /* MB 5/4/93 temporarily taking the color picker out of demobook
- XtAddCallback( ColorButton, XmNactivateCallback,
- activateCB_ColorButton,
- (XtPointer) UxCreateGroupContext );
- */
-
- /*
- XtAddCallback( GroupGL, GlxNinputCallback,
- inputCB_GroupGL,
- NULL);
-
- */
- return ( CreateGroup_shell );
- }
- /*******************************************************************************
- The following function includes the code that was entered
- in the 'Initial Code' and 'Final Code' sections of the
- Declarations Editor. This function is called from the
- 'Interface function' below.
- *******************************************************************************/
-
- static Widget _Ux_create_CreateGroup()
- {
- Widget rtrn;
- _UxCCreateGroup *UxContext;
-
- UxCreateGroupContext = UxContext =
- (_UxCCreateGroup *) XtMalloc( sizeof(_UxCCreateGroup) );
-
- rtrn = _Uxbuild_CreateGroup();
-
- XtRealizeWidget ( CreateGroup_shell );
-
- SetWMhints ( CreateGroup_shell );
-
- return(rtrn);
- }
-
- /*******************************************************************************
- The following is the 'Interface function' which is the
- external entry point for creating this interface.
- This function should be called from your application or from
- a callback function.
- *******************************************************************************/
-
- Widget create_CreateGroup()
- {
- Widget _Uxrtrn;
-
- _Uxrtrn = _Ux_create_CreateGroup();
-
- return ( _Uxrtrn );
- }
-
- popup_CreateGroup()
- {
- struct grptmpltstruct *grpptr;
- char title_string[20];
-
- if (EditGroupFlag == 1)
- strcpy (title_string, "EditingBook");
- else
- strcpy (title_string, "NewBook");
- XtVaSetValues( CreateGroup_shell,
- XmNtitle, title_string,
- NULL );
-
- XtVaSetValues( GroupExistKeywordList,
- XmNitemCount, ExistKeywordCount,
- RES_CONVERT( XmNitems, ExistKeywordString ),
- NULL );
-
- if (EditGroupFlag == 1) {
- grpptr = curgroup;
- XtVaSetValues( GroupNameText, XmNvalue, grpptr->nameptr->string, NULL );
- XtVaSetValues( GroupNameText, XmNcursorPosition, strlen(grpptr->nameptr->string), NULL );
- if (grpptr->helpfile != NULL)
- {
- XtVaSetValues( GroupHelpFileText, XmNvalue, grpptr->helpfile->name, NULL );
- XtVaSetValues( GroupHelpFileText, XmNcursorPosition, strlen(grpptr->helpfile->name), NULL );
-
- }
- if (GroupKeywordCount > 0)
- XtVaSetValues( GroupKeywordList,
- XmNitemCount, GroupKeywordCount,
- RES_CONVERT( XmNitems, GroupKeywordString ),
- NULL );
-
- XtUnmapWidget(GroupNextButton);
- }
- else
- XtMapWidget(GroupNextButton);
-
- UxPopupInterface(CreateGroup, no_grab);
-
- }
-
- GetGroupKeywords()
- {
- int keyword_count;
- XmString *keyword_table;
- char *keyword_string;
- Arg args[5];
- int i, n;
- struct charlist *newcharptr;
-
- if (KW_change) {
- n = 0;
- XtSetArg(args[n], XmNitemCount, &keyword_count); n++;
- XtSetArg(args[n], XmNitems, &keyword_table); n++;
- XtGetValues(GroupKeywordList, args, n);
- /* printf("Num Group Keywords = %d\n", keyword_count); */
- HeadGrpChar = NULL;
- TailGrpChar = NULL;
- if (keyword_count > 0) {
- for (i=0; i<keyword_count; i++) {
- keyword_string = extract_first_xms_segment(keyword_table[i]);
- newcharptr = (struct charlist *)malloc(sizeof(struct charlist) );
- newcharptr->next = NULL;
- if (HeadGrpChar == NULL)
- HeadGrpChar = newcharptr;
- else
- TailGrpChar->next = newcharptr;
- TailGrpChar = newcharptr;
- if (find_keyword(keyword_string) != NULL) {
- TailGrpChar->indexflag = 1;
- TailGrpChar->str = keyword_string;
- }
- else {
- TailGrpChar->indexflag = 0;
- TailGrpChar->str = (char *)malloc(strlen(keyword_string)+1);
- strcpy(TailGrpChar->str, keyword_string);
- }
- /* printf("%s\n", TailGrpChar->str); */
- }
- }
- }
- }
-
- /*******************************************************************************
- END OF FILE
- *******************************************************************************/
-
-